package com.dfbz.demo01_缓存字节流;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;

/**
 * @author lscl
 * @version 1.0
 * @intro:
 */
public class Demo01_缓存字节流拷贝文件 {
    public static void main(String[] args) throws Exception {

        long startTime = System.currentTimeMillis();

        // 缓存字节输入流
        BufferedInputStream bis = new BufferedInputStream(new FileInputStream("D:/apache-tomcat-8.0.43-feedback.zip"));

        // 缓存字节输出流
        BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("D:/tomcat.zip"));

        int data;

        while ((data = bis.read()) != -1) {
            bos.write(data);
        }

        bis.close();
        bos.close();

        long endTime = System.currentTimeMillis();

        System.out.println(endTime - startTime);
    }
}
